package com.wk.code.wkserver.controller.app;


import com.wk.code.wkserver.controller.common.BaseController;
import com.wk.code.wkserver.request.app.DemandOrderRequest;
import com.wk.code.wkserver.response.app.DemandOrderResponse;
import com.wk.code.wkserver.response.result.R;
import com.wk.code.wkserver.service.IDemandOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * User 控制层
 *
 * @Author wq
 * @Date 2021-03-16
 **/
@RestController
@RequestMapping("/demandOrder")
@Api(tags = "app-前台需求订单管理")
public class DemandOrderController extends BaseController {

    @Resource
    private IDemandOrderService demandOrderService;


    /**
     * 需求订单分页列表
     *
     * @param request 请求参数
     * @return R
     */
    @ApiOperation(value = "我的订单")
    @PostMapping("/page")
    public R<List<DemandOrderResponse>> acquire(@RequestBody DemandOrderRequest request) {
        return R.success(demandOrderService.demandOrderList(getUserId(), request));
    }

    /**
     * 我的接单订单分页列表
     *
     * @param request 请求参数
     * @return R
     */
    @ApiOperation(value = "我的接单")
    @PostMapping("/mineTakingOrder")
    public R<List<DemandOrderResponse>> mineTakingOrder(@RequestBody DemandOrderRequest request) {
        return R.success(demandOrderService.mineTakingOrder(getUserId(), request));
    }
}